#include<bits/stdc++.h>
using namespace std;
#define xyf main

const int maxn=105;
const int maxv=21000;
int f[maxv];
int a[maxn];
int v[maxn];
int V,n;
int maxd;

inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
}

inline void init()
{
	scanf("%d%d",&V,&n);
	for(int i=1;i<=n;++i)
		scanf("%d",&v[i]);
}

inline void print()
{
	printf("%d ",maxd);
	for(int i=1;i<=maxd;++i)
		printf("%d ",a[i]);
	exit(0);
}

inline bool check(int x)
{
	int &s=f[x];
	if(s!=-1)
		return s;
	if(x==0)
		return s=1;
	for(int i=1;i<=maxd;++i)
		if(x>=a[i]&&check(x-a[i]))
			return s=1;
	return s=0;
}

inline void dfs(int depth,int k)
{
	if(depth>maxd)
	{
		memset(f,-1,sizeof(f));
		if(check(V))
			print();
		return;
	}
	if(k>n)
		return;
	a[depth]=v[k];
	dfs(depth+1,k+1);
	dfs(depth,k+1);
}

inline void id_dfs()
{
	sort(v+1,v+n+1);
	n=unique(v+1,v+n+1)-v-1;
	for(maxd=1;maxd<=n;++maxd)
		dfs(1,1);
}

int xyf()
{
	init();
	id_dfs();
	return 0;
}
